<template>
<transition name="el-zoom-in-center">
<div class="JNPF-preview-main">
    <div class="JNPF-common-page-header">
        <el-page-header @back="goBack"
                        content="详情"/>
        <div class="options">
            <el-button @click="goBack">取 消</el-button>
        </div>
    </div>
<el-row :gutter="15" class=" main" :style="{margin: '0 auto',width: '100%'}">
<el-form ref="elForm" :model="dataForm" size="small" label-width="100px" label-position="right" >
    <template v-if="!loading">
	    <el-col :span="24" >
		<el-form-item  label-width="0">
		<groupTitle  content-position="center"  :closable= "false"  content ="采购员与物料关系" >
		</groupTitle>
	</el-form-item>
	</el-col>
            <el-col :span="12" >
                <el-form-item  label="组织"   prop="org" >
                        <p>{{dataForm.org}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="采购员"   prop="purchaser" >
                        <p>{{dataForm.purchaser}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="单据号"   prop="code" >
                        <p>{{dataForm.code}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="单据日期"   prop="billdate" >
                        <p>{{dataForm.billdate}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="创建用户"   prop="creatoruserid" >
                        <p>{{dataForm.creatoruserid}}</p>
                </el-form-item>
            </el-col>
            <el-col :span="12" >
                <el-form-item  label="创建部门"   prop="createdept" >
                        <p>{{dataForm.createdept}}</p>
                </el-form-item>
            </el-col>
    <el-col :span="24"  >
    <el-form-item label-width="0">
            <div class="JNPF-common-title">
                <h2>物料关系子表</h2>
            </div>
    <el-table :data="dataForm.gypurchasersmaterialsbList" size='mini'   >
        <el-table-column type="index" width="50" label="序号" align="center" />
            <el-table-column prop="matcode" label="物料编码">
            <template slot-scope="scope">
                            <p>{{scope.row.matcode}}</p>
        </template>
        </el-table-column>
            <el-table-column prop="description" label="备注">
            <template slot-scope="scope">
                            <p>{{scope.row.description}}</p>
        </template>
        </el-table-column>
    </el-table>
    </el-form-item>
    </el-col>
    </template>
</el-form>
    </el-row>
    </div>
</transition>
</template>
<script>
    import request from '@/utils/request'
    import PrintBrowse from '@/components/PrintBrowse'
    import jnpf from '@/utils/jnpf'
    export default {
        components: {PrintBrowse},
        props: [],
        data() {
            return {
                visible: false,
                loading: false,
                printBrowseVisible: false,
                printId: '',
            dataForm: {
                id :'',
                            org : [],
                            purchaser : '',
                            code : '',
                            billdate : "",
                            creatoruserid : "",
                            createdept : '',
                        gypurchasersmaterialsbList:[],
            },

        }
        },
        computed: {},
        watch: {},
        created() {

        },
        mounted() {},
        methods: {
            dataInfo(dataAll){
                let _dataAll =dataAll
                for(let i=0;i<_dataAll.gypurchasersmaterialsbList.length;i++){
                    var _list = _dataAll.gypurchasersmaterialsbList[i];
                }
                this.dataForm = _dataAll
            },

                goBack() {
                    this.$emit('refresh')
                },
            init(id) {
                this.dataForm.id = id || 0;
                this.visible = true;
                this.$nextTick(() => {
                    if(this.dataForm.id){
                        this.loading = true
                        request({
                            url: '/api/example/GyPurchasersMaterials/detail/'+this.dataForm.id,
                            method: 'get'
                        }).then(res => {
                            this.dataInfo(res.data)
                            this.loading = false
                        })
                    }

                })
            },
        },
    }

</script>
